package com.sidneysimmons.financially.activities;

import com.sidneysimmons.financially.managers.UserManager;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class FinanciallyActivity extends BaseActivity {
	
	private final String CLASS_NAME = this.getClass().getName();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState, CLASS_NAME);
		
		// if logged in, redirect to main page
		// else, redirect to login/register page
		if (UserManager.isLoggedIn(this)) {
			Log.d(CLASS_NAME, "User is already logged in - redirecting to CateogryListActivity.");

			Intent intent = new Intent(this, AccountActivity.class);
			startActivity(intent);
			finish();
		} else {
			Log.d(CLASS_NAME, "User not logged in - redirecting to LoginActivity.");
			
			Intent intent = new Intent(this, LoginActivity.class);
			startActivity(intent);
			finish();
		}
	}
	
	@Override
	protected void onStart() {
		super.onStart(CLASS_NAME);
	}
	
	@Override
	protected void onResume() {
		super.onResume(CLASS_NAME);
	}
	
	@Override
	protected void onPause() {
		super.onPause(CLASS_NAME);
	}
	
	@Override
	protected void onStop() {
		super.onStop(CLASS_NAME);
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy(CLASS_NAME);
	}
}